package com.tarena.lbs.controller.api;

import com.tarena.lbs.service.AttachService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/attach")
@Api(tags = "附件绑定与解绑接口")
public class AttachApiController {

    @DubboReference
    private AttachService attachService;

    @PostMapping("/bindImage")
    @ApiOperation(value = "绑定图片", notes = "将指定用户与图片进行绑定")
    public boolean bindImage(@RequestParam Long userId, @RequestParam String imageId) {
        return attachService.bindImage(userId, imageId);
    }

    @PostMapping("/unbindImage")
    @ApiOperation(value = "解绑图片", notes = "解除指定用户与图片的绑定关系")
    public boolean unbindImage(@RequestParam Long userId, @RequestParam String imageId) {
        return attachService.unbindImage(userId, imageId);
    }
}